<?php
require("../db_conn.php");

//获取信息
$cname=$_POST['cname'];

$ename=$_POST['ename'];

$url=$_POST['url'];

//echo $e_dept;
//echo $e_name;
//echo $e_img;
// 将信息传递到数据库  执行
$sql="insert into tb_admin (cname,ename,url) values('$cname','$ename','$url')";
$amrs=$db->query($sql); //执行sql语句 将结果赋给$result

//判断是否添加成功
if($amrs)
{
    echo "<script language='javascript'type='text/javascript'>";
    echo   " alert('注册成功');";
    echo   " window.location.href='page.php';";
    echo    "</script>";
}
else
{
    echo "<script language='javascript'type='text/javascript'>";
    echo   " alert('添加失败');";
    echo   " window.location.href='addpage.php';";
    echo    "</script>";
}
